import {Vector} from "./Vector";
import {IVector4} from "./types";
import {Vector3} from "./Vector3";

export class Vector4 extends Vector  implements IVector4{

    constructor(x: number = 0, y: number =0, z: number = 0, w: number = 1) {
        super(4);
        this.x = x;
        this.y = y;
        this.z = z;
        this.w = w;
    }

    set x(value: number) {
        this.data[0] = value;
    }
    get x() {
        return this.data[0];
    }
    set y(value: number) {
        this.data[1] = value;
    }
    get y() {
        return this.data[1];
    }
    set z(value: number) {
        this.data[2] = value;
    }
    get z() {
        return this.data[2];
    }
    set w(value: number) {
        this.data[3] = value;
    }
    get w() {
        return this.data[3];
    }

    toVector3() {
        return new Vector3(this.x, this.y, this.z);
    }

}